/**
 * 将B转换为自适应单位的大小
 * @param number
 * @returns {string}
 */
export const convertCapacity = (number) => {
    const units = ['B', 'KB', 'MB', 'GB', 'TB'];
    let index = 0;

    while (number >= 1024 && index < units.length - 1) {
        number /= 1024;
        index++;
    }

    return parseInt(number) + units[index];
}